package com.baohua.service;

import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.baohua.exception.BaohuaSystemException;
import com.baohua.model.Staff;

/**
 * 员工Service接口
 * @author czp
 *
 */
public interface StaffService {

	/**
	 * 根据条件查询员工列表
	 * @param staff 员工对象
	 * @param pre_employDate  前置入职时间
	 * @param af_employDate 后置入职时间
	 * @param pre_leaveDate 前置离职时间
	 * @param af_leaveDate 后置离职时间
	 * @param active 是否有效
	 * @param sex 性别
	 * @param page
	 * @param pageSize
	 * @return
	 */
	public Map queryStaff(Staff staff, String pre_employDate,
			String af_employDate, String pre_leaveDate, String af_leaveDate,
			String active, String sex, int page, int pageSize);
	
	/**
	 * 根据员工编号查询员工
	 * @param staffNo
	 * @return
	 */
	public Staff queryStaffByStaffNo(String staffNo) throws BaohuaSystemException;
	
	
	/**
	 * 增加员工
	 * @param staff
	 * @param employee
	 * @param roles
	 * @throws BaohuaSystemException
	 * @throws ParseException
	 */
	public void addStaff(Staff staff, String employee, String[] roles) throws BaohuaSystemException, ParseException;
	
	/**
	 * 根据ID删除员工
	 * @param staffId
	 * @throws BaohuaSystemException
	 */
	public void delStaff(int staffId) throws BaohuaSystemException;
	
	/**
	 * 修改员工
	 * @param staff
	 * @throws BaohuaSystemException
	 */
	public void updateStaff(Staff staff) throws BaohuaSystemException;
	
	/**
	 * 员工登录
	 * @param username
	 * @param password
	 * @return
	 */
	public Staff loginStaff(String username, String password) throws BaohuaSystemException;
	
	/**
	 * 根据HQL语句统计员工
	 * @param sql
	 * @return
	 */
	public long countStaff(String sql);
	
	/**
	 * 根据员工Id进行查询
	 * @param staffId
	 * @return
	 * @throws BaohuaSystemException
	 */
	public Staff queryStaffById(int staffId) throws BaohuaSystemException;
	
	/**
	 * 根据员工ID进行查询员工角色，将角色ID加入到List中
	 * @param staffId
	 * @return
	 * @throws BaohuaSystemException
	 */
	public List<Integer> queryRolesById(int staffId) throws BaohuaSystemException;
	
	/**
	 * 根据员工编号的数组, 查询员工列表
	 * @param staffNOs
	 * @return
	 */
	public List<Staff> queryByStaffNOs(String[] staffNOs);
	
	/**
	 * 导出数据/模板
	 * @param output 缓存输出流
	 * @param file 导出文件
	 * @param list 导出数据
	 * @param sheetName 工作薄的名字
	 * @param HttpServletRequest request Request对象
	 * @param HttpServletResponse response Response对象
	 * @throws IllegalArgumentException
	 * @throws IOException
	 * @throws IllegalAccessException
	 */
	public void exportData(String fileName, List list, String sheetName, 
			 HttpServletRequest request, HttpServletResponse response)
					 throws IllegalArgumentException, 
			 IOException, IllegalAccessException;
}
